/** @jsxRuntime automatic */
/** @jsxImportSource ../xml-runtime */
import { NTSC } from './NTSC'

function Audio({ pathObject, mediaInfo }) {
  return (
    <file id="s">
      <pathurl>{pathObject.base}</pathurl>
      <name>{pathObject.base}</name>
      <rate>
        <timebase>{mediaInfo.frameRate}</timebase>
        <NTSC value={mediaInfo.ntsc}></NTSC>
      </rate>
      <duration>{mediaInfo.frameCount}</duration>
      <timecode>
        <rate>
          <timebase>{mediaInfo.frameRate}</timebase>
          <NTSC value={mediaInfo.ntsc}></NTSC>
        </rate>
        <string>00:00:00:00</string>
        <frame>0</frame>
        <displayformat>NDF</displayformat>
      </timecode>
      <media>
        <audio>
          <samplecharacteristics>
            <depth>{mediaInfo.depth}</depth>
            <samplerate>{mediaInfo.sampleRate}</samplerate>
          </samplecharacteristics>
          <channelcount>{mediaInfo.channelCount}</channelcount>
        </audio>
      </media>
    </file>
  )
}

function Video({ pathObject, mediaInfo }) {
  return (
    <file id="s">
      <pathurl>{pathObject.base}</pathurl>
      <name>{pathObject.base}</name>
      <rate>
        <timebase>{mediaInfo.frameRate}</timebase>
        <NTSC value={mediaInfo.ntsc}></NTSC>
      </rate>
      <duration>{mediaInfo.frameCount}</duration>
      <timecode>
        <rate>
          <timebase>{mediaInfo.frameRate}</timebase>
          <NTSC value={mediaInfo.ntsc}></NTSC>
        </rate>
        <string>00:00:00:00</string>
        <frame>0</frame>
        <displayformat>NDF</displayformat>
      </timecode>
      <media>
        <video>
          <samplecharacteristics>
            <rate>
              <timebase>{mediaInfo.frameRate}</timebase>
              <NTSC value={mediaInfo.ntsc}></NTSC>
            </rate>
            <width>{mediaInfo.width}</width>
            <height>{mediaInfo.height}</height>
            <pixelaspectratio>square</pixelaspectratio>
          </samplecharacteristics>
        </video>
        <audio>
          <samplecharacteristics>
            <depth>{mediaInfo.depth}</depth>
            <samplerate>{mediaInfo.sampleRate}</samplerate>
          </samplecharacteristics>
          <channelcount>{mediaInfo.channelCount}</channelcount>
        </audio>
      </media>
    </file>
  )
}

export const File = { Audio, Video }
